package com.hzdp.jvm;

import java.lang.reflect.Method;

public class MultiClassLoader {

	private MultiClassLoader instance;

	public void set(Object multiClassLoader) {
		instance = (MultiClassLoader) multiClassLoader;
	}

	public MultiClassLoader() {
	}

	public static void main(String[] args) {
		FileSystemClassLoader classLoader1 = new FileSystemClassLoader("/Users/liuming/git/hzdp-service/target/classes");
		FileSystemClassLoader classLoader2 = new FileSystemClassLoader("/Users/liuming/git/hzdp-service/target/classes");

		try {
			Object class1 = classLoader1.loadClass("com.hzdp.cache.service.impl.Sample").newInstance();
			Object class2 = classLoader2.loadClass("com.hzdp.cache.service.impl.Sample").newInstance();

			Method method = class1.getClass().getMethod("set", Object.class);
			method.invoke(class1, class2);
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}
